/*
 * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.extensions;

/**
 * @author Eike Stepper
 */
public class DBIndex implements IDBIndex {
    private final DBTable table;

    private final IDBField[] fields;

    private final String name;

    public DBIndex(DBTable table, String name, IDBField[] fields) {
        this.table=table;
        this.name=name;
        this.fields=fields;
    }

    @Override
    public DBTable getTable() {
        return table;
    }

    @Override
    public IDBField getField(int index) {
        return fields[index];
    }

    @Override
    public int getFieldCount() {
        return fields.length;
    }

    @Override
    public IDBField[] getFields() {
        return fields;
    }

    @Override
    public String getName() {
        return name;
    }
}
